

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

/**
 * @ Author : Weijian_Wang
 * @ Date : Created in 21:57 2020/10/28 0028
 * @ Description ：
 */
public class Solution1 {
    public boolean uniqueOccurrences(int[] arr) {
        Map<Integer, Integer> map = new HashMap<>();
        for(int num : arr) {
            map.put(num, map.getOrDefault(num, 0) + 1);
        }

        Set<Integer> times = new HashSet<>();
        for(Map.Entry<Integer, Integer> entry : map.entrySet()) {
            times.add(entry.getValue());
        }

        return map.size() == times.size();
    }
}
